from flask import render_template, request

from app.models import Sku
from . import main


@main.route('/')
def index():
    return render_template('index.html')


@main.route('/query', methods=['post'])
def query():
    keyword = request.form['keyword']
    # TODO: 分页查询
    sku = Sku.query.filter_by(keyword=keyword).all()
    print(sku)
    return render_template('tag.html', sku=sku)
